###################################
# Project: Mondiali Sci Alpinismo #
###################################

#
# Compilers (C++ and C)
#
CPP  = g++
CC   = gcc

#
# Object files
#
OBJ  =  main.o \
        GUI.o \
		Menu.o SubMenu.o \
		BMPImage.o MapImage.o IconButton.o \
        BackGroundImage.o ImageButton.o \
        BlinkingImage.o VideoImage.o ProgressBar.o \
		FSM.o \
		Events.o \
		Controller.o  \
        Joystick.o \
        Keyboard.o \
        Mouse.o \
		ObjectList.o \
		Movie.o \
		Scenegraph.o\
		Camera.o \
		Land.o \
		Sky.o \
		Clouds.o \
		LensFlare.o \
		Moon.o \
		SkyDome.o \
		Stars.o \
		Sun.o \
        State.o SplashScreenState.o ScenarioCreationState.o InitState.o IntroState.o \
        LoadBriefingState.o ViewBriefingState.o LoadScenarioState.o NewScenarioState.o \
        OptionsState.o CreditsState.o ExitState.o \
		CPUTest.o FPSTest.o \
		Waypoint.o

LINKOBJ  =  main.o \
            GUI.o \
			Menu.o SubMenu.o \
			BMPImage.o MapImage.o IconButton.o \
            BackGroundImage.o ImageButton.o \
            BlinkingImage.o VideoImage.o ProgressBar.o \
			FSM.o \
			Events.o \
            Controller.o  \
            Joystick.o \
            Keyboard.o \
            Mouse.o \
			ObjectList.o \
			Movie.o \
			Scenegraph.o\
			Camera.o \
			Land.o \
			Sky.o \
			Clouds.o \
			LensFlare.o \
			Moon.o \
			SkyDome.o \
			Stars.o \
			Sun.o \
            State.o SplashScreenState.o ScenarioCreationState.o InitState.o IntroState.o \
            LoadBriefingState.o ViewBriefingState.o LoadScenarioState.o NewScenarioState.o \
            OptionsState.o CreditsState.o ExitState.o \
			CPUTest.o FPSTest.o \
			Waypoint.o

#
# Libraries
#

# -L"C:/Programmi/Dev-Cpp/lib"  -L"C:/Programmi/Dev-Cpp/lib" 

STD_LIBS =  -lobjc -framework Carbon -framework IOKit
OPENGL_LIBS = -framework OpenGL -framework GLUT
PLIB_LIBS = -lplibul -lplibsg -lplibssg -lplibssgAux -lplibul -lplibfnt -lplibpu -lplibpuAux -lplibjs

#
# Includes
#

INCS = 

# -I"C:/Programmi/Dev-Cpp/include"  -I"C:/Programmi/Dev-Cpp/include" 

CXXINCS =

#
# Output binary file
#

BIN  = MondialiSciAlpinismo.app

#
# Compiler flags
#

CXXFLAGS = $(CXXINCS) -Wall -g -02
# -DWIN32 -DNDEBUG -D_CONSOLE -D_MBCS   -w

CFLAGS = $(INCS) -Wall -g -02
#-DWIN32 -DNDEBUG -D_CONSOLE -D_MBCS   -w

#
# Remove
#

RM = rm -f

#
# Rules
#

.PHONY: all all-before all-after clean clean-custom

all: all-before MondialiSciAlpinismo.app all-after


clean: clean-custom
	${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
	$(CPP) $(LINKOBJ) -o $(BIN) $(STD_LIBS) $(OPENGL_LIBS) $(PLIB_LIBS)

main.o: main.cpp
	$(CPP) -c main.cpp -o main.o $(CXXFLAGS)

GUI.o: GUI.cpp
	$(CPP) -c GUI.cpp -o GUI.o $(CXXFLAGS)
	
Menu.o: Menu.cpp
	$(CPP) -c Menu.cpp -o Menu.o $(CXXFLAGS)
	
SubMenu.o: SubMenu.cpp
	$(CPP) -c SubMenu.cpp -o SubMenu.o $(CXXFLAGS)

BMPImage.o: BMPImage.cpp
	$(CPP) -c BMPImage.cpp -o BMPImage.o $(CXXFLAGS)
	
MapImage.o: MapImage.cpp
	$(CPP) -c MapImage.cpp -o MapImage.o $(CXXFLAGS)
	
VideoImage.o: VideoImage.cpp
	$(CPP) -c VideoImage.cpp -o VideoImage.o $(CXXFLAGS)

BackGroundImage.o: BackGroundImage.cpp
	$(CPP) -c BackGroundImage.cpp -o BackGroundImage.o $(CXXFLAGS)

ImageButton.o: ImageButton.cpp
	$(CPP) -c ImageButton.cpp -o ImageButton.o $(CXXFLAGS)
	
IconButton.o: IconButton.cpp
	$(CPP) -c IconButton.cpp -o IconButton.o $(CXXFLAGS)

BlinkingImage.o: BlinkingImage.cpp
	$(CPP) -c BlinkingImage.cpp -o BlinkingImage.o $(CXXFLAGS)

ProgressBar.o: ProgressBar.cpp
	$(CPP) -c ProgressBar.cpp -o ProgressBar.o $(CXXFLAGS)

Controller.o: Controller.cpp
	$(CPP) -c Controller.cpp -o Controller.o $(CXXFLAGS)

FSM.o: FSM.cpp
	$(CPP) -c FSM.cpp -o FSM.o $(CXXFLAGS)

Events.o: Events.cpp
	$(CPP) -c Events.cpp -o Events.o $(CXXFLAGS)

Joystick.o: Joystick.cpp
	$(CPP) -c Joystick.cpp -o Joystick.o $(CXXFLAGS)

Keyboard.o: Keyboard.cpp
	$(CPP) -c Keyboard.cpp -o Keyboard.o $(CXXFLAGS)

Mouse.o: Mouse.cpp
	$(CPP) -c Mouse.cpp -o Mouse.o $(CXXFLAGS)

ObjectList.o: ObjectList.cpp
	$(CPP) -c ObjectList.cpp -o ObjectList.o $(CXXFLAGS)

Movie: Movie.cpp
	$(CPP) -c Movie.cpp -o Movie.o $(CXXFLAGS)

Scenegraph.o: Scenegraph.cpp
	$(CPP) -c Scenegraph.cpp -o Scenegraph.o $(CXXFLAGS)
	
Camera.o: Camera.cpp
	$(CPP) -c Camera.cpp -o Camera.o $(CXXFLAGS)
	
Land.o: Land.cpp
	$(CPP) -c Land.cpp -o Land.o $(CXXFLAGS)

Sky.o: Sky.cpp
	$(CPP) -c Sky.cpp -o Sky.o $(CXXFLAGS)
	
Clouds.o: Clouds.cpp
	$(CPP) -c Clouds.cpp -o Clouds.o $(CXXFLAGS)
	
LensFlare.o: LensFlare.cpp
	$(CPP) -c LensFlare.cpp -o LensFlare.o $(CXXFLAGS)
	
Moon.o: Moon.cpp
	$(CPP) -c Moon.cpp -o Moon.o $(CXXFLAGS)
	
SkyDome.o: SkyDome.cpp
	$(CPP) -c SkyDome.cpp -o SkyDome.o $(CXXFLAGS)
	
Stars.o: Stars.cpp
	$(CPP) -c Stars.cpp -o Stars.o $(CXXFLAGS)
	
Sun.o: Sun.cpp
	$(CPP) -c Sun.cpp -o Sun.o $(CXXFLAGS)	

State.o: State.cpp
	$(CPP) -c State.cpp -o State.o $(CXXFLAGS)

SplashScreenState.o: SplashScreenState.cpp
	$(CPP) -c SplashScreenState.cpp -o SplashScreenState.o $(CXXFLAGS)

ScenarioCreationState.o: ScenarioCreationState.cpp
	$(CPP) -c ScenarioCreationState.cpp -o ScenarioCreationState.o $(CXXFLAGS)

InitState.o: InitState.cpp
	$(CPP) -c InitState.cpp -o InitState.o $(CXXFLAGS)

IntroState.o: IntroState.cpp
	$(CPP) -c IntroState.cpp -o IntroState.o $(CXXFLAGS)

LoadBriefingState.o: LoadBriefingState.cpp
	$(CPP) -c LoadBriefingState.cpp -o LoadBriefingState.o $(CXXFLAGS)

ViewBriefingState.o: ViewBriefingState.cpp
	$(CPP) -c ViewBriefingState.cpp -o ViewBriefingState.o $(CXXFLAGS)

LoadScenarioState.o: LoadScenarioState.cpp
	$(CPP) -c LoadScenarioState.cpp -o LoadScenarioState.o $(CXXFLAGS)

NewScenarioState.o: NewScenarioState.cpp
	$(CPP) -c NewScenarioState.cpp -o NewScenarioState.o $(CXXFLAGS)

OptionsState.o: OptionsState.cpp
	$(CPP) -c OptionsState.cpp -o OptionsState.o $(CXXFLAGS)

CreditsState.o: CreditsState.cpp
	$(CPP) -c CreditsState.cpp -o CreditsState.o $(CXXFLAGS)

ExitState.o: ExitState.cpp
	$(CPP) -c ExitState.cpp -o ExitState.o $(CXXFLAGS)
	
CPUTest.o: CPUTest.cpp
	$(CPP) -c CPUTest.cpp -o CPUTest.o $(CXXFLAGS)

FPSTest.o: FPSTest.cpp
	$(CPP) -c FPSTest.cpp -o FPSTest.o $(CXXFLAGS)
		
Waypoint.o: Waypoint.cpp
	$(CPP) -c Waypoint.cpp -o Waypoint.o $(CXXFLAGS)	